<template>
  <div id="goTop">
    <transition name="slide-fade">
      <div class="goTop" v-show="goTopShow" @click="goTopFun">
        <i class="iconfont icon-huidaodingbu2 goTopIcon"></i>
        <!-- 回到顶部 -->
      </div>
    </transition>
  </div>
</template>

<script>
export default {
  name: "goTop",
  props: ["goTopShow"],
  data() {
    return {};
  },

  methods: {
    goTopFun() {
      this.$parent.goTop();
    },
  },
};
</script>

<style scoped lang="scss">
@media screen and (min-width: 1200px) {
  .slide-fade-enter-active {
    transition: all 0.6s ease;
  }

  .slide-fade-leave-active {
    transition: all 0.6s cubic-bezier(1, 0.5, 0.8, 1);
  }

  .slide-fade-enter,
  .slide-fade-leave-to {
    transform: translateY(60px);
  }

  .goTop {
    position: fixed;
    right: 40px;
    bottom: 80px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    z-index: 99;
    background: #fff;
    padding: 10px;
    cursor: pointer;
    /* box-shadow: 0 0 6px rgba(0, 0, 0, 0.12); */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border: 3px solid rgba(51, 153, 255, 1);
  }

  .goTop:hover {
    background: rgba(51, 153, 255, 1);
  }

  .goTop:hover .goTopIcon {
    color: #fff;
  }

  .goTopIcon {
    font-size: 34px;
    color: rgba(51, 153, 255, 0.8);
  }
}

@media screen and (min-width: 992px) and (max-width: 1199px) {
  .slide-fade-enter-active {
    transition: all 0.6s ease;
  }

  .slide-fade-leave-active {
    transition: all 0.6s cubic-bezier(1, 0.5, 0.8, 1);
  }

  .slide-fade-enter,
  .slide-fade-leave-to {
    transform: translateY(60px);
  }

  .goTop {
    position: fixed;
    right: 40px;
    bottom: 80px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #fff;
    padding: 10px;
    cursor: pointer;
    /* box-shadow: 0 0 6px rgba(0, 0, 0, 0.12); */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(51, 153, 255, 1);
  }

  .goTop:hover {
    background: rgba(51, 153, 255, 1);
  }

  .goTop:hover .goTopIcon {
    color: #fff;
  }

  .goTopIcon {
    font-size: 18px;
    color: rgba(51, 153, 255, 0.8);
  }
}

@media screen and (min-width: 768px) and (max-width: 992px) {
  .slide-fade-enter-active {
    transition: all 0.6s ease;
  }

  .slide-fade-leave-active {
    transition: all 0.6s cubic-bezier(1, 0.5, 0.8, 1);
  }

  .slide-fade-enter,
  .slide-fade-leave-to {
    transform: translateY(60px);
  }

  .goTop {
    z-index: 9999;
    position: fixed;
    right: 10px;
    bottom: 80px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    padding: 10px;
    cursor: pointer;
    /* box-shadow: 0 0 6px rgba(0, 0, 0, 0.12); */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(51, 153, 255, 1);
  }

  .goTopIcon {
    font-size: 18px;
    color: rgba(51, 153, 255, 0.8);
  }
}

@media screen and (max-width: 767px) {
  .slide-fade-enter-active {
    transition: all 0.6s ease;
  }

  .slide-fade-leave-active {
    transition: all 0.6s cubic-bezier(1, 0.5, 0.8, 1);
  }

  .slide-fade-enter,
  .slide-fade-leave-to {
    transform: translateY(60px);
  }

  .goTop {
    z-index: 9999;
    position: fixed;
    right: 10px;
    bottom: 80px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: #fff;
    padding: 10px;
    cursor: pointer;
    /* box-shadow: 0 0 6px rgba(0, 0, 0, 0.12); */
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(51, 153, 255, 1);
  }

  .goTopIcon {
    font-size: 18px;
    color: rgba(51, 153, 255, 0.8);
  }
}</style>